package 模拟实现二叉树;

public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        System.out.print("前序遍历: ");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.print("中序遍历: ");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.print("后序遍历: ");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.print("层序遍历: ");
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println("二叉树中结点个数: "+binaryTree.size(root));
        System.out.println("二叉树中叶子结点个数: "+binaryTree.getLeafNodeCount(root));
        System.out.println("二叉树第3层结点个数: "+binaryTree.getKLevelNodeCount(root,3));
        System.out.println("二叉树的高度: "+binaryTree.getHeight(root));
        System.out.println("二叉树中值为B的结点地址: "+binaryTree.find(root,'B'));
        System.out.println("二叉树中值为Z的结点地址: "+binaryTree.find(root,'Z'));
        System.out.println("此二叉树是否为完全二叉树: "+binaryTree.isCompleteTree(root));
    }
}
